﻿@using BonjourQuotation.UI.Models.CustomerModel
@model CustomerDetailsViewModel
@{
    
}
@using (@Html.BeginForm("SaveCustomerDetailData", "Customer", FormMethod.Post, new { id = "LoadCustomerDetailsForm", style = "height: 0px;" }))
{
     <div id="ErrorMessagesDivPopUp">
        <label for="Validation" id="errorMessageClient" class="errorMessage"></label>
        @if (Model.Message != null)
        {
            @Html.LabelForModel(Model.Message, new { @class = "errorMessage", id = "errorMessageServer" })
        }
    </div>
    
    @Html.HiddenFor(model => model.CustomerID)
    @Html.HiddenFor(model => model.SelectedCity)
    <div class="pull-right" style="margin-bottom:15px;">
        <div class="row form-row">
            <div class="ElementsPaddingRight30 col-lg-3">
                <div class="input-group">
                    <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.CustomerCode)</span>
                    @Html.TextBoxFor(model => model.CustomerCode, new { @class = "table_inputs_SmallPadding2 inpputgr form-control ElementsForValidation MaxLength20 Required CustomerDetailsElementChange" })
                </div>
            </div>
            <div class="ElementsPaddingRight30 col-lg-5">
                <div class="input-group">
                    <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.OrganizationName)</span>
                    @Html.TextBoxFor(model => model.OrganizationName, new { @class = "table_inputs_SmallPadding2 inpputgr form-control ElementsForValidation MaxLength50 Required CustomerDetailsElementChange" })
                </div>
            </div>
            <div class="ElementsPaddingRight30 col-lg-4">
                <div class="input-group">
                    <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.CCEMail)</span>
                    @Html.TextBoxFor(model => model.CCEMail, new { @class = "table_inputs_SmallPadding2 inpputgr form-control ElementsForValidation Email CustomerDetailsElementChange" })
                </div>
            </div>
        </div>
        <div class="row form-row">
            <div class="ElementsPaddingRight30 col-lg-4">
                <div class="input-group">
                    <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.PhoneNumber1)</span>
                    @Html.TextBoxFor(model => model.PhoneNumber1, new { @class = "table_inputs_SmallPadding2 inpputgr form-control ElementsForValidation MaxLength20 CustomerDetailsElementChange" })
                </div>
            </div>
            <div class="ElementsPaddingRight30 col-lg-4">
                <div class="input-group">
                    <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.PhoneNumber2)</span>
                    @Html.TextBoxFor(model => model.PhoneNumber2, new { @class = "table_inputs_SmallPadding2 inpputgr form-control ElementsForValidation MaxLength20 CustomerDetailsElementChange" })
                </div>
            </div>
            <div class="ElementsPaddingRight30 col-lg-4">
                <div class="input-group">
                    <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.FaxNumber)</span>
                    @Html.TextBoxFor(model => model.FaxNumber, new { @class = "table_inputs_SmallPadding2 inpputgr form-control ElementsForValidation MaxLength20 CustomerDetailsElementChange" })
                </div>
            </div>
        </div>
        <div class="row form-row">
            <div class="ElementsPaddingRight30 col-lg-5">
                <div class="input-group">
                    <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.SelectedCountryID)</span>
                    @Html.DropDownListFor(model => model.SelectedCountryID, new SelectList(Model.CountryID, "Value", "Text"), "Select", new { @class = "table_inputs_SmallPadding2 inpputgr form-control ElementsForValidation CountryDrop Required CustomerDetailsElementChange" })
                </div>
            </div>
            <div class="ElementsPaddingRight30 col-lg-2" id="StateDiv" @((Model.SelectedCountryID != "1" || Model.SelectedCountryID == "") ? new { @style = "Display:None" } : new { @style = "Display:block" })>
                <div class="input-group">
                    @Html.DropDownListFor(model => model.SelectedStateID, new SelectList(Model.StateID, "Value", "Text"), "Select", new { @class = "table_inputs_SmallPadding2 inpputgr form-control StateDrop CustomerDetailsElementChange" })
                </div>
            </div>
            <div class="ElementsPaddingRight30 col-lg-2" id="StateDivChange" @((Model.SelectedCountryID != "1" || Model.SelectedCountryID == "") ? new { @style = "Display:block" } : new { @style = "Display:None" })>
            </div>
            <div class="ElementsPaddingRight30 col-lg-5" id="CityDiv" @(((Model.SelectedCountryID == "1" && (Model.SelectedStateID == "" || Model.SelectedStateID == null)) || Model.SelectedCountryID == "") ? new { @style = "Display:None" } : new { @style = "Display:block" })>
                <div class="input-group">
                    <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.CityID)</span>
                    @Html.DropDownListFor(model => model.CityID, new SelectList(Model.City, "Value", "Text"), "Select", new { @class = "table_inputs_SmallPadding2 inpputgr form-control CityDrop CustomerDetailsElementChange" })
                </div>
            </div>
            <div class="ElementsPaddingRight30 col-lg-5" id="CityDivChange" @(((Model.SelectedCountryID == "1" && (Model.SelectedStateID == "" || Model.SelectedStateID == null)) || Model.SelectedCountryID == "") ? new { @style = "Display:block" } : new { @style = "Display:None" })>
            </div>
        </div>
        <div class="row form-row">
            <div class="ElementsPaddingRight30 col-lg-5">
                <div class="input-group">
                    <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.Address)</span>
                    @Html.TextBoxFor(model => model.Address, new { @class = "table_inputs_SmallPadding2 inpputgr form-control CustomerDetailsElementChange ElementsForValidation MaxLength100" })
                </div>
            </div>
            <div class="ElementsPaddingRight30 col-lg-5">
                <div class="input-group">
                    <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.Address2)</span>
                    @Html.TextBoxFor(model => model.Address2, new { @class = "table_inputs_SmallPadding2 inpputgr form-control CustomerDetailsElementChange ElementsForValidation MaxLength100" })
                </div>
            </div>
            <div class="ElementsPaddingRight30 col-lg-2">
                <div class="input-group">
                    <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.PostalCode)</span>
                    @Html.TextBoxFor(model => model.PostalCode, new { @class = "table_inputs_SmallPadding2 inpputgr form-control ElementsForValidation MaxLength20 CustomerDetailsElementChange" })
                </div>
            </div>
        </div>
        <div class="row form-row" style="padding-left: 240px;">
            <div class="ElementsPaddingRight30 col-lg-4">
                <div class="input-group">
                    <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.Active, new { @class = "CustomerDetailsElementChange" })</span>
                    @Html.CheckBoxFor(model => model.Active, new { @class = "CustomerDetailsElementChange" })
                </div>
            </div>
            <div class="ElementsPaddingRight30 col-lg-4">
                <div class="input-group">
                    <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.Mail, new { @class = "CustomerDetailsElementChange" })</span>
                    @Html.CheckBoxFor(model => model.Mail, new { @class = "CustomerDetailsElementChange" })
                </div>
            </div>
            <div class="ElementsPaddingRight30 col-lg-4">
                <div class="input-group">
                    <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">Unformatted:</span>
                    <input type="checkbox" id="PhoneNumberUnformatted">
                </div>
            </div>
        </div>
        <div class="row form-row">
            <div class="ElementsPaddingRight30 col-lg-12">
                <div class="input-group">
                    <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.Note)</span>
                    @Html.TextAreaFor(model => model.Note, new { @class = "table_inputs_SmallPadding2 inpputgr form-control CustomerDetailsElementChange" })
                </div>
            </div>
        </div>
        @if (Model.CustomerID == 0)
        {
            <div class="SaveCancelDiv">
                <button class="btn14 btn50" type="button" onclick="$('#cboxClose').click()">Cancel</button>
                @if (Model.MenuManageCustomerEdit)
                {
                    <button class="btn14 btn50" type="button" id="CustomerDetailsSaveBtn">Save</button>
                }
                else
                {
                    <button class="btn14 btn50 disabled" type="button" disabled="disabled" id="CustomerDetailsSaveBtn">Save</button>
                }
            </div>
        }
        else
        { 
            <div style="width: 941px; min-height: 100px; max-height: 166px; margin: auto; float: left; padding-bottom: 30px; padding-top: 15px; margin-left: 9px; ">
                <table class="table table-bordered table-hover table-condensed" style="margin-bottom: -1px !important; width: 920px;background-color:white;">
                    <thead>
                        <tr>
                            <th width="20%;" class="GridHeaders font12">Contact Name</th>
                            <th width="20%;" class="GridHeaders font12">Contact Title</th>
                            <th width="20%;" class="GridHeaders font12">Contact Email</th>
                            <th width="20%;" class="GridHeaders font12">Contact Phone</th>
                            <th width="20%;" class="GridHeaders font12">Contact Fax</th>
                        </tr>
                    </thead>
                </table>
                <div style="height: 126px; overflow-y: auto;">
                    <table class="table table-bordered table-hover table-condensed" style="width: 920px; table-layout: fixed; background-color: white;">
                        <tbody>
                            @for (int ind = 0; ind < Model.ContactRows.Count; ind++)
                            {
                                @Html.HiddenFor(model => Model.ContactRows[ind].CCID)
                                @Html.HiddenFor(model => Model.ContactRows[ind].CustomerID)
                                <tr>
                                    <td width="20%;">@Html.TextBoxFor(model => model.ContactRows[ind].Name, new { @class = "CustomerDetailsElementChange table_inputs_180 table_inputs_WithoutBox ElementsForValidation MaxLength50 Required" })</td>
                                    <td width="20%;">@Html.TextBoxFor(model => model.ContactRows[ind].Title, new { @class = "CustomerDetailsElementChange table_inputs_180 table_inputs_WithoutBox ElementsForValidation MaxLength200" })</td>
                                    <td width="20%;">@Html.TextBoxFor(model => model.ContactRows[ind].EMail, new { @class = "CustomerDetailsElementChange table_inputs_180 table_inputs_WithoutBox ElementsForValidation MaxLength250 Email" })</td>
                                    <td width="20%;">@Html.TextBoxFor(model => model.ContactRows[ind].Phone, new { @class = "CustomerDetailsElementChange table_inputs_180 table_inputs_WithoutBox GridPhone ElementsForValidation MaxLength20" })</td>
                                    <td width="20%;">@Html.TextBoxFor(model => model.ContactRows[ind].Fax, new { @class = "CustomerDetailsElementChange table_inputs_180 table_inputs_WithoutBox GridFax ElementsForValidation MaxLength20" })</td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
            </div>
            <div style="width: 941px; height: 110px; margin-left: 9px; float: left; padding-top: 10px" id="CustomerSaveCloseAddNewCustomerContactDetailBtns">
                @if (Model.MenuManageCustomerEdit)
                {
                    <button class="btn14 btn50" style="float: right; margin-right: 15px; " type="button" id="CustomerDetailsSaveBtn">Save</button>
                    <button class="btn14 btn50" style="float: right; margin-right: 15px; " type="button" onclick="$('#cboxClose').click()">Cancel</button>
                    <button class="btn14 btn130" style="float: right; margin-right: 15px; " type="button" onclick="AddNewCustomerContactDetailsShow()">Add New Contact</button>
                }
                else
                {
                    <button class="btn14 btn50 disabled" style="float: right; margin-right: 15px; " type="button" disabled="disabled" id="CustomerDetailsSaveBtn">Save</button>
                    <button class="btn14 btn50" style="float: right; margin-right: 15px; " type="button" onclick="$('#cboxClose').click()">Cancel</button>
                    <button class="btn14 btn130 disabled" style="float: right; margin-right: 15px; " type="button" disabled="disabled" onclick="AddNewCustomerContactDetailsShow()">Add New Contact</button>
                }
            </div>
        }
    </div>
}
@using (@Html.BeginForm("SaveCustomerDetailData", "Customer", FormMethod.Post, new { id = "LoadAddCustomerContactDetailsForm", @style = "height:0px;margin-top: 130px;" }))
{
    <div id="CustomerContactDetailsDiv" style="display: none; height: 110px; float: left; ">
        <div id="ErrorMessagesDivPopUp">
            <label for="Validation" id="errorMessageClient" class="errorMessage"></label>
            @if (Model.Message != null)
            {
                @Html.LabelForModel(Model.Message, new { @class = "errorMessage", id = "errorMessageServer" })
            }
        </div>
        <div style="width: 941px; margin-left: 9px; float:left">
            <table class="table table-bordered table-hover table-condensed" style="width: 920px; table-layout: fixed; background-color: white;">
                <tbody>
                    <tr>
                        <td width="20%;">@Html.TextBoxFor(model => model.Name, new { @class = "AddCustomerContactDetailsElementChange table_inputs_180 table_inputs_WithoutBox ElementsForValidation MaxLength50 Required" })</td>
                        <td width="20%;">@Html.TextBoxFor(model => model.Title, new { @class = "AddCustomerContactDetailsElementChange table_inputs_180 table_inputs_WithoutBox ElementsForValidation MaxLength200" })</td>
                        <td width="20%;">@Html.TextBoxFor(model => model.EMail, new { @class = "AddCustomerContactDetailsElementChange table_inputs_180 table_inputs_WithoutBox ElementsForValidation MaxLength250 Email" })</td>
                        <td width="20%;">@Html.TextBoxFor(model => model.Phone, new { @class = "AddCustomerContactDetailsElementChange table_inputs_180 table_inputs_WithoutBox ElementsForValidation MaxLength20" })</td>
                        <td width="20%;">@Html.TextBoxFor(model => model.Fax, new { @class = "AddCustomerContactDetailsElementChange table_inputs_180 table_inputs_WithoutBox ElementsForValidation MaxLength20" })</td>
                    </tr>
                </tbody>
            </table>
            <div style="float: right;margin-right:21px;">
                <button class="btn14 btn50" type="button" onclick="AddNewCustomerContactDetailsClose()">Cancel</button>
                @if (Model.MenuManageCustomerEdit)
                {
                    <button class="btn14 btn50" type="button" id="AddCustomerContactDetailBtn">Save</button>
                }
                else
                {
                    <button class="btn14 btn50 disabled" type="button" disabled="disabled" id="AddCustomerContactDetailBtn">Save</button>
                }
            </div>
        </div>
    </div>
}





